package pers.hl.module_main.book_detail

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.entity.SectionEntity
import pers.hl.lib_global.model.bean.Book
import pers.hl.lib_global.model.bean.Comment

abstract class DetailItem(private val type: Int, override val isHeader: Boolean) : SectionEntity {

    companion object {
        const val TYPE_TITLE = 1
        const val TYPE_DESC = 2
        const val TYPE_COMMENT = 3
        const val TYPE_EMPTY = 999
    }

    override val itemType: Int
        get() = type

    abstract fun getData(): Any?

    class DetailHeader(private val data: Book?) : DetailItem(SectionEntity.HEADER_TYPE, true) {
        override fun getData(): Book? {
            return data
        }
    }

    class DetailTitle(private val data: Title?) : DetailItem(TYPE_TITLE, false) {
        override fun getData(): Title? {
            return data
        }
    }

    class DetailText(private val data: Text?) : DetailItem(TYPE_DESC, false) {
        override fun getData(): Text? {
            return data
        }
    }

    class DetailComment(private val data: Comment?) : DetailItem(TYPE_COMMENT, false) {
        override fun getData(): Comment? {
            return data
        }
    }

    data class Title(val type: Int, val data: String?)

    data class Text(val type: Int, val data: String?)

}